package com.spzx.cart.api;

import com.spzx.cart.api.domain.CartInfo;
import com.spzx.cart.api.fallback.CartFeignClientFallbackFactory;
import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

/**
 * @ClassName CartFeignClient
 * @Author 波
 * @Date 2024/8/11 14:05
 */
@FeignClient(contextId = "cartFeignClient", value = ServiceNameConstants.CART_SERVICE, fallbackFactory = CartFeignClientFallbackFactory.class)
public interface CartFeignClient {
    @GetMapping("/getCartCheckedList/{userId}")
    public R<List<CartInfo>> getCartCheckedList(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/updateCartCheckedPrice/{userId}")
    public R<Boolean> updateCartCheckedPrice(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @DeleteMapping("/deleteCartInfo/{userId}")
    public R<Boolean> deleteCheckedCartInfo(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
